Skip to content

fix: add examples as workspace members for standalone execution#93

Merged
Larry-Osakwe merged 7 commits intomainfrom
larry/fix-example-workspace-members
Apr 6, 2026
Merged

fix: add examples as workspace members for standalone execution#93
Larry-Osakwe merged 7 commits intomainfrom
larry/fix-example-workspace-members

Conversation

@Larry-Osakwe
Copy link
Copy Markdown
Contributor

@Larry-Osakwe Larry-Osakwe commented Apr 6, 2026

Summary

Fixes examples so they can be run directly from their directory with uv run python main.py.

Before

cd packages/mcp-fastmcp/examples/delegated_access
uv run python main.py
# error: keycardai-oauth references a workspace but is not a workspace member

After

cd packages/mcp-fastmcp/examples/delegated_access
uv run python main.py
# works

What changed

  1. Remove redundant [tool.uv.sources] from packages/mcp-fastmcp/pyproject.toml and packages/mcp/pyproject.toml — these declared workspace = true for sibling packages, which broke resolution when uv loaded them via editable paths outside the workspace context. The root pyproject.toml already declares all workspace sources.

  2. Add packages/*/examples/* to workspace members in the root pyproject.toml so examples participate in workspace resolution.

  3. Disambiguate duplicate example names — two delegated-access-example projects across mcp and mcp-fastmcp caused a workspace name collision.

  4. Improve delegated_access example (from Sean's Fix delegated_access example project and support Zone URL #94) — adds KEYCARD_ZONE_URL support, streamlines README.

Tested all 9 examples locally — all resolve and import successfully from their own directory.

Test plan

  • All 9 examples run from their directory with uv run python main.py
  • Root uv sync still resolves correctly
  • CI passes

Running `uv run python main.py` from an example directory failed because
examples were not workspace members. Their editable path loaded the parent
package pyproject which has `workspace = true` sources, but those only
resolve within the workspace context.

Adding `packages/*/examples/*` to workspace members fixes this for all
9 examples across mcp-fastmcp, mcp, oauth, and agents.
Two delegated_access examples (mcp-fastmcp and mcp) were both named
delegated-access-example, causing uv workspace member name collision.

Renamed to delegated-access-fastmcp-example and
delegated-access-lowlevel-example.
Package-level [tool.uv.sources] with `workspace = true` caused failures
when examples resolved deps via editable paths — uv loaded the package
pyproject outside the workspace context and could not resolve the
workspace references.

The root pyproject.toml already declares all workspace sources, so
package-level declarations were redundant. Removing them lets examples
run directly from their directory with `uv run python main.py`.
…er README

Incorporates improvements from Sean's PR #94:
- Support KEYCARD_ZONE_URL in addition to KEYCARD_ZONE_ID
- Remove hardcoded fallback values for credentials
- Streamline README install/run steps
- Add note for local SDK development workflow
The workspace fix makes examples resolve against local source by
default — no need for a separate root-level command.
The test suite imports the example without env vars set. Removing the
fallback defaults caused ClientSecret to receive None, failing the
client_id validation.
Sean's improvement removed the explicit zone_id parameter, relying on
AuthProvider's internal env var discovery. But the test suite imports the
example without env vars, so AuthProvider raises
AuthProviderConfigurationError. Restore the fallback default.
@Larry-Osakwe Larry-Osakwe merged commit 6afa87f into main Apr 6, 2026
6 checks passed
@Larry-Osakwe Larry-Osakwe deleted the larry/fix-example-workspace-members branch April 6, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants